/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package framework.view;

import framework.model.Factory;
import framework.model.FinancialCompany;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTable;

/**
 *
 * @author ThanhNguyen
 */
public class UI extends JFrame {

    private FinancialCompany financialCompany;
    private TopPanel topPanel;
    private OperationPanel operationPanel;
    private TablePanel tablePanel;

    public TablePanel getTablePanel() {
        return tablePanel;
    }
    protected JTable table;

    public void setFinancialCompany(FinancialCompany financialCompany) {
        this.financialCompany = financialCompany;
    }

    public FinancialCompany getFinancialCompany() {
        return financialCompany;
    }

    public UI() {
        setTitle("Financial Company Application");
        setSize(580, 340);
        setLayout(null);
        setResizable(false);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Factory factory = Factory.getInstance();

        topPanel = factory.createTopPanel();
        add(topPanel);
        operationPanel = factory.createOperationPanel();
        add(operationPanel);
        tablePanel = factory.createTablePanel();
        add(tablePanel);
        table = tablePanel.getTable();

        JButton btnExit = new JButton();
        btnExit.setText("Exit");
        btnExit.setBounds(479, 270, 90, 33);
        btnExit.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                System.exit(0);
            }
        });
        add(btnExit);
    }

    public JTable getTable() {
        return table;
    }
}
